package org.ksug.samples.springmvc;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class AccountController {

	@Autowired
	private AccountRepository repository;

	@RequestMapping("/accounts/show.do")
	protected void show(@RequestParam("number") String number,
			Map<String, Account> model) throws Exception {
		model.put("account", repository.findAccount(number));
	}

	public void setRepository(AccountRepository repository) {
		this.repository = repository;
	}

}